// packagePay/pages/insurance-programme/insurance-programme.js
import user from "../../../utils/user"
import { getIntroduceImg } from '../../api/insurance'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        insureCompanyType:'',
        gscPlan:'',
        wesurePlan:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad() {
        getIntroduceImg().then(res=>{
            console.log(res,'res')
            const obj = JSON.parse(res)
            console.log(obj,'objobj')
            console.log(obj.gscPlan,obj.wesurePlan,'obj')
            this.setData({
                gscPlan:obj.gscPlan.url,
                wesurePlan:obj.wesurePlan.url
            })
            // wx.setNavigationBarColor({
            //     frontColor:'#ffffff',
            //     backgroundColor:user.insureCompanyType === 'insure002_gsc' ? obj.gscPlan.colour : obj.wesurePlan.colour 
            // })
        })
    },
    onReady () {
        console.log(user,'user123')
        this.setData({
            insureCompanyType:user.insureCompanyType
        })
    },

    onShow: function () {
    },
    onPreviewImage(event){
        const { url } = event.currentTarget.dataset
        wx.previewImage({
            urls: [url]
        })
    }
})